const tick = Date.now();

const log = (x) => console.log(`${x} \n Time:${Date.now() - tick}`);

const codeBlocker = () => {
  //把代码放在resolve.then中可以保证同步代码全部先执行完
  return Promise.resolve().then((v) => {
    let i = 0;
    while (i < 1000000000) {
      i++;
    } //已经在主线程执行
    return "🍋loops done";
  });
};

log("🍅async1");
codeBlocker().then(log);
log("🍅async2"); //打印出来的时候仍然会有延迟
